// Define and invoke a closure
def simpleClosure = {arg1, arg2 ->
	println "Invoke a closure, with args: $arg1, $arg2"
}

simpleClosure(1, 2)

// Closure as param
class ClosureCaller {
	def call1(Closure closure, arg1, arg2) {
		println ''
		println 'Invoke a closure from call1'
		closure(arg1, arg2)
	}
	
	def call2(arg1, arg2, Closure closure) {
		println ""
		println "call2..."
		closure(arg1, arg2)
	}
}

def cc = new ClosureCaller()
cc.call1(simpleClosure, 1, 2)

cc.call2(1, 2) {arg1, arg2 ->
	println "It is a closure with $arg1, $arg2"
}